package com.huhao.concurrency.example.publish;

import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;

@Slf4j
public class UnSafePublish {
    private String[] states = {"a", "b", "c"};

    public String[] getStates() {
        return states;
    }

    public static void main(String[] args) {
        UnSafePublish unsafePublish = new UnSafePublish();
        log.info("{}", Arrays.toString(unsafePublish.getStates())); // [a, b, c]
        unsafePublish.getStates()[0] = "d";
        log.info("{}", Arrays.toString(unsafePublish.getStates())); // [d, b, c]
    }

}